#include <nds.h>
#include <stdio.h>
 
int main(void)
{
	int held;

	consoleDemoInit();
 
	while(1)
	{
		scanKeys();
		held = keysHeld();
 
		if( held & KEY_A)
			printf("Key A is pressed\n");
		else
			printf("Key A is released\n");
 
		if( held & KEY_X)
			printf("Key X is pressed\n");
		else
			printf("Key X is released\n");
 
		if( held & KEY_TOUCH)
			printf("Touch pad is touched\n");
		else
			printf("Touch pad is not touched\n");
 
		                //+---------------- % = print a variable
		                //|+--------------- 0 = with leading zeros
		                //||+-------------- 4 = 4 numbers wide
		                //|||+------------- x = in hexadecimal
		                //vvvv
		printf("held is 0x%04x\n", held); 

		swiWaitForVBlank();
 
		consoleClear();
	}
 
	return 0;
}
